package tcu.iot.gasmanage.api;

import org.springframework.web.bind.annotation.*;
import tcu.iot.gasmanage.common.DownloadResult;
import tcu.iot.gasmanage.common.Result;
import tcu.iot.gasmanage.service.DownloadService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/document")
@CrossOrigin
public class DownloadController {

    @Resource
    private DownloadService downloadService;

    @PostMapping("/update")
    public DownloadResult UpdateInfo() {
        return downloadService.UpdateInfo();
    }

    @GetMapping("/download")
    public Result Download(HttpServletRequest request, HttpServletResponse response) {
        return downloadService.Download(request, response);
    }
}
